package com.ruoyi.system.mapper;

import java.util.List;
import java.util.Map;

import com.ruoyi.system.domain.ProvideAllRecords;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 供应商付款Mapper接口
 * 
 * @author ruoyi
 * @date 2024-05-08
 */
public interface ProvideAllRecordsMapper 
{
    /**
     * 查询供应商付款
     * 
     * @param id 供应商付款主键
     * @return 供应商付款
     */
    public ProvideAllRecords selectProvideAllRecordsById(Long id);

    /**
     * 查询供应商付款列表
     * 
     * @param provideAllRecords 供应商付款
     * @return 供应商付款集合
     */
    public List<ProvideAllRecords> selectProvideAllRecordsList(ProvideAllRecords provideAllRecords);

    /**
     * 新增供应商付款
     * 
     * @param provideAllRecords 供应商付款
     * @return 结果
     */
    public int insertProvideAllRecords(ProvideAllRecords provideAllRecords);

    /**
     * 修改供应商付款
     * 
     * @param provideAllRecords 供应商付款
     * @return 结果
     */
    public int updateProvideAllRecords(ProvideAllRecords provideAllRecords);

    /**
     * 删除供应商付款
     * 
     * @param id 供应商付款主键
     * @return 结果
     */
    public int deleteProvideAllRecordsById(Long id);

    /**
     * 批量删除供应商付款
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteProvideAllRecordsByIds(Long[] ids);

    @Select("select create_time,provide,Round(sum(plarn_price*product_count),4)money,Round(sum(product_price*product_count),4)priceMoney  from provide_records where create_time = #{time} group by provide,create_time")
    public List<Map<String,Object>> selectAllRecords(@Param("time")String time);



    public Double selectSumMoney(@Param("provide")String provide,@Param("financeCode")String financeCode, @Param("createTime")String createTime, @Param("status")String status);

    @Select("delete from provide_all_records where create_time = #{time}")
    public Integer deleteUpload(@Param("time")String time);


    public int insertBatch(List<ProvideAllRecords> provideAllRecords);

    @Select("select sum(payable_money) from provide_all_records where createTime = #{createTime} and provide = #{provider}")
    public Double selectProviderMoney(@Param("provider")String provider,@Param("createTime")String createTime);
}
